<template>
	<view style="padding: 30rpx;">
		<view v-for="(item,index) in csList" :key="index" @click="toSGDetail(item.id)"
			style="padding: 30rpx;background-color: #fff;border-radius: 16rpx;margin-bottom: 20rpx;">
			<view style="display: flex;align-items: center;justify-content: space-between;">
				<view style="font-size: 32rpx;width: 80%;">{{item.name}}</view>
				<view style="font-size: 24rpx;width: 20%;text-align: end;">施工中</view>
			</view>
			<!-- <view style="margin-top: 15rpx;">
				<text>相关企业：</text>
				<text style="margin-left: 5rpx;color: #999;">{{item.constructionCompany}}</text>
			</view> -->
			<view style="margin-top: 10rpx;">
				<text>工地类型：</text>
				<text style="margin-left: 5rpx;color: #999;">{{item.typeText}}</text>
			</view>
			<view style="margin-top: 10rpx;">
				<text>详细地址：</text>
				<text style="margin-left: 5rpx;color: #999;">{{item.address}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageNum: 1,
				pageSize: 20,
				csList: []
			}
		},
		onLoad() {
			this.initSGCS()
		},
		methods: {
			initSGCS() {
				// ：工地类型字典：1.房屋建筑工地	2.拆迁土地3.收储工地4.绿化园林工地	5.市政道路工地	6.地铁市政工地	7.企业建筑工地	8.房屋装修
				this.$u.get("/driver/constructionSitePage", {
					// 'pageNum': this.pageNum,
					// 'pageSize': this.pageSize
				}).then(res => {
					if (res.code == 200) {
						let csList = res.rows
						for (let s of csList) {
							if (s.type == 1) {
								s.typeText = "房屋建筑工地"
							} else if (s.type == 2) {
								s.typeText = "拆迁土地"
							} else if (s.type == 3) {
								s.typeText = "收储工地"
							} else if (s.type == 4) {
								s.typeText = "绿化园林工地"
							} else if (s.type == 5) {
								s.typeText = "市政道路工地"
							} else if (s.type == 6) {
								s.typeText = "地铁市政工地"
							} else if (s.type == 7) {
								s.typeText = "企业建筑工地"
							} else if (s.type == 8) {
								s.typeText = "房屋装修"
							}
						}
						this.csList = csList
					}
				})
			},

			toSGDetail(id) {
				uni.navigateTo({
					url: "sg-detail/sg-detail?id=" + id
				})

			}

		}
	}
</script>

<style>

</style>